- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Add DTO and DTO Collection for GetAllUserPost use case #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DTO and DTO Collection for GetAllUserPost use case #209
Conversation
…with-pagination Add pagination support to GetAllUserPostQueryService and provide corresponding integration test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Confirmed that all fields in GetAllUserPostDto are strictly typed and immutable (readonly).
- Verified that build()methods in both DTO and Collection validate the input structure as expected.
- Ensured compatibility with existing application layers by keeping userIdandmediaPathnaming consistent.
- Unit tests comprehensively cover both normal and edge cases, including missing mediaPath.
- Considered future extensibility by avoiding premature abstraction (no factory class for now — inline static method suffices).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces DTO classes for the GetAllUserPost use case, providing structured value objects and a collection wrapper.
- Adds GetAllUserPostDtowithbuild()for instantiation andtoArray()for serialization.
- Introduces GetAllUserPostDtoCollectionwith abuild()factory andgetPosts()accessor.
- Provides unit tests validating DTO and collection construction and property values.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description | 
|---|---|
| src/app/Post/Application/Dto/GetAllUserPostDto.php | Added DTO with constructor, build(), andtoArray()methods | 
| src/app/Post/Application/Dto/GetAllUserPostDtoCollection.php | Added collection class with build()factory andgetPosts()method | 
| src/app/Post/Application/ApplicationTest/GetAllUserPostDtoTest.php | Added tests for DTO instantiation and value assertions | 
| src/app/Post/Application/ApplicationTest/GetAllUserPostDtoCollectionTest.php | Added tests for collection instantiation and per-item value checks | 
Files not reviewed (1)
- .idea/workspace.xml: Language not supported
Comments suppressed due to low confidence (6)
src/app/Post/Application/Dto/GetAllUserPostDtoCollection.php:16
- Consider adding a PHPDoc block to build()to describe the expected structure of$items, for example@param array<string,mixed>[] $itemsto clarify that each element is raw post data.
public static function build(array $items): self
src/app/Post/Application/Dto/GetAllUserPostDto.php:26
- There's no unit test covering toArray()—add a test to assert thattoArray()output matches the DTO properties for full serialization coverage.
public function toArray(): array
src/app/Post/Application/ApplicationTest/GetAllUserPostDtoTest.php:10
- [nitpick] The setUp()override is empty and not used—consider removing it to reduce boilerplate in tests.
protected function setUp(): void
src/app/Post/Application/ApplicationTest/GetAllUserPostDtoTest.php:15
- [nitpick] The tearDown()override is empty—consider removing it if there's no custom teardown logic.
protected function tearDown(): void
src/app/Post/Application/ApplicationTest/GetAllUserPostDtoCollectionTest.php:10
- [nitpick] This setUp()method is overridden but empty—removing it can streamline the test class.
protected function setUp(): void
src/app/Post/Application/ApplicationTest/GetAllUserPostDtoCollectionTest.php:15
- [nitpick] This empty tearDown()override isn't used—consider removing it for cleaner test code.
protected function tearDown(): void
Description
This pull request introduces the following data transfer objects to represent post data returned from the GetAllUserPost use case:
GetAllUserPostDto: A readonly value object encapsulating an individual post's ID, user ID, content, optional media path, and visibility status.GetAllUserPostDtoCollection: A typed collection ofGetAllUserPostDtoinstances, designed to standardise the output of multiple post entities in a structured format.Implementation Details
GetAllUserPostDtoincludes a staticbuild()method to construct an instance from a flat array, and atoArray()method for serialisation purposes.GetAllUserPostDtoCollectionwraps an array of DTOs and provides abuild()factory for consistency with DDD-style instantiation.